home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / fitbitmaptobox.pprx < prev    next >
Text File  |  1992-07-17  |  1KB  |  53 lines

  1. /* Fit image exactly into box, distorting as needed, assuming a screen resolution of 75 dpi in hi-res.
  2. Written by Don Cox  July '92  */
  3.  
  4.  
  5. signal on error
  6. signal on syntax
  7.  
  8. address command
  9. call ppm_AutoUpdate(0)
  10. call SafeEndEdit.rexx()
  11. oldunits = ppm_GetUnits()
  12. call ppm_SetUnits(1)
  13.  
  14. box = ppm_ClickOnBox("Click on box...")
  15.  
  16. if box=0 then do
  17. call ppm_Inform(1,"No box selected",)
  18. call ppm_ClearStatus()
  19. exit
  20. end
  21.  
  22. boxtype = upper(word(ppm_GetBoxInfo(box), 1))
  23. if boxtype~="BITMAP" then do
  24. call ppm_Inform(1,"Not a bitmap box",)
  25. call ppm_ClearStatus()
  26. exit
  27. end
  28.  
  29. size = ppm_GetBoxSize(box)
  30. boxwidth = word(size,1)
  31. boxheight = word(size,2)
  32. margins = ppm_GetBoxMargins(box)
  33. parse var margins mleft mtop mright mbottom
  34. boxwidth = boxwidth-mleft-mright
  35. boxheight = boxheight-mtop-mbottom
  36.  
  37.  
  38. info = ppm_GetBoxInfo(box)
  39. width = word(info,2)
  40. height = word(info,3)
  41.  
  42.     width = width/75  /* screen images at 75dpi for high res */
  43.     xscale = boxwidth/width
  44.     height = height/75
  45.     yscale = boxheight/height
  46.  
  47.  
  48. call ppm_SetBoxScale(box,xscale,yscale)
  49. call ppm_SetBoxOffset(box,0,0)
  50.  
  51. call ppm_SetUnits(oldunits)
  52. call ppm_AutoUpdate(1)
  53. exit